package com.mygdx.game.Scenes;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;

public class Character_A extends Actor {
    Texture abd;
    public static float X;
    public static float Y;
    public static float width;
    public static float heigth;
    TextureRegion walkFrame;
    Animation animation;
    TextureRegion current;

    public Character_A(float X, float Y){
        this.X = X;
        this.Y = Y;
        this.show();
    }

    public void show() {
        walkFrame =new TextureRegion();
        abd = new Texture((Gdx.files.internal("Character/GreenNPC (1).png")));
        walkFrame = new TextureRegion(abd);
        width = walkFrame.getRegionWidth();
        heigth = walkFrame.getRegionHeight();
        animation = new Animation(0.025f,walkFrame);
        this.setPosition(X,Y);
    }

    public void update(){
//        if(Gdx.input.isKeyPressed(Input.Keys.A)){
//            X = X-20;
////            this.setX(this.getX()-50);
////            this.setPosition(getX(),getY());
//            System.out.println("LEFT");
//        }
//        if(Gdx.input.isKeyPressed(Input.Keys.D)){
//            X = X+20;
//
//            System.out.println("RIGHT");
//        }
//        if(Gdx.input.isKeyPressed(Input.Keys.W)){
//            Y = Y+20;
//            System.out.println("UP");
//        }
//        if(Gdx.input.isKeyPressed(Input.Keys.S)){
//            Y = Y-20;
//            System.out.println("DOWN");
//        }
//        //左边界-100 右边界1550 上边界700 下边界-100
//        if (X<-100){
//            X=-100;
//        }
//        if (X>1550)
//        {
//            X=1550;
//        }
//        if (Y<-100)
//        {
//            Y=-100;
//        }
//        if(Y>700){
//            Y=700;
//        }
    }
    @Override
    public void draw(Batch batch, float parentAlpha) {
       this.update();

       batch.draw(walkFrame, X, Y);
    }
   @Override
   public void act(float delta) {
        super.act(delta);
    }
}
